/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package autodiaryserver;

import java.sql.DriverManager;

/**
 *
 * @author thang
 */
public class ConnectionManager {
   
    public static void connectDb(){
        try {
            String driverName = "com.mysql.jdbc.Driver";
            String dbUser = "thang";
            String dbPassword = "123";
            String dbName = "mysql";
            String host = "localhost";
            String url = "jdbc:mysql://" + host + "/" + dbName + "?user=" 
                    + dbUser + "&password=" + dbPassword;
            Class.forName(driverName).newInstance();
            Declare.jdbcCon = DriverManager.getConnection(url);
            
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
    
    public static void disconnectDb(){
        try{
            Declare.jdbcCon.close();
        } catch (Throwable t){}
    }


}
